package fatworm.storage.file;

public class Block
{
    public String filename;
    public int blknum;

    public Block(String filename, int blknum)
    {
        this.filename = filename;
        this.blknum = blknum;
    }
    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + blknum;
        result = prime * result + ((filename == null) ? 0 : filename.hashCode());
        return result;
    }
    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
            return true;
        Block other = (Block) obj;
        if (blknum != other.blknum)
            return false;
        if (filename == null)
        {
            if (other.filename != null)
                return false;
        } else if (!filename.equals(other.filename))
            return false;
        return true;
    }
    public String toString()
    {
        return "[file " + filename + ", block " + blknum + "]";
    }
}
